<?php
/**
 * +----------------------------------------------------------------------
 * | 九月科技-ztuc.cn
 * +----------------------------------------------------------------------
 *                      .::::.
 *                    .::::::::.            | AUTHOR: siyu
 *                    :::::::::::           | EMAIL: ztucke@ztuc.cn
 *                 ..:::::::::::'           | DATETIME: 2020/01/31
 *             '::::::::::::'
 *                .::::::::::
 *           '::::::::::::::..
 *                ..::::::::::::.
 *              ``::::::::::::::::
 *               ::::``:::::::::'        .:::.
 *              ::::'   ':::::'       .::::::::.
 *            .::::'      ::::     .:::::::'::::.
 *           .:::'       :::::  .:::::::::' ':::::.
 *          .::'        :::::.:::::::::'      ':::::.
 *         .::'         ::::::::::::::'         ``::::.
 *     ...:::           ::::::::::::'              ``::.
 *   ```` ':.          ':::::::::'                  ::::..
 *                      '.:::::'                    ':'````..
 * +----------------------------------------------------------------------
 */
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/3/13
 * Time: 20:11
 */
namespace app\store\controller;



use think\App;
use think\facade\Request;
use think\Response;
use think\response\Redirect;
use think\exception\HttpResponseException;
use think\facade\View;
use think\facade\Db;
/**
 * 首页控制器
 * Class Install
 * @package app\controller\index
 */
class Install
{ 
  public function __construct(App $app)
    {
        $this->app     = $app;
        $this->request = $this->app->request;

    }
     // install
    public function install()
    { 
//-- -----------------------------
//-- Table structure for `cms_user_token`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user_token`;
Db::execute("CREATE TABLE `cms_user_token` (
  `token` varchar(50) NOT NULL COMMENT 'Token',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
  `admin_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '管理员ID',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `expire_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
  `verification_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '验证身份时间',
  PRIMARY KEY (`token`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会员Token表';");

//-- -----------------------------
//-- Records of `cms_user_token`
//-- -----------------------------
Db::execute("INSERT INTO `cms_user_token` VALUES ('079b40a8cf1f549bad6ba71f6aac9034602426e4', '0', '1', '1719470092', '1720074892', '1719470092');");

//-- -----------------------------
//-- Table structure for `cms_user_score_log`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user_score_log`;
Db::execute("CREATE TABLE `cms_user_score_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
  `score` int(11) NOT NULL DEFAULT '0' COMMENT '变更积分',
  `before` int(11) NOT NULL DEFAULT '0' COMMENT '变更前积分',
  `after` int(11) NOT NULL DEFAULT '0' COMMENT '变更后积分',
  `memo` varchar(255) NOT NULL DEFAULT '0' COMMENT '备注',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会员积分变动表';");


//-- -----------------------------
//-- Table structure for `cms_user_rule`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user_rule`;
Db::execute("CREATE TABLE `cms_user_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `pid` int(11) DEFAULT NULL COMMENT '父ID',
  `url_name` varchar(50) DEFAULT '#' COMMENT '跳转链接',
  `name` varchar(50) DEFAULT NULL COMMENT '标题名称',
  `ismenu` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单1=显示菜单，0=隐藏',
  `openType` enum('_iframe','_blank','_layer') DEFAULT '_iframe' COMMENT '菜单类型',
  `icon` varchar(50) DEFAULT NULL COMMENT '图标',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `weigh` int(11) DEFAULT '0' COMMENT '权重',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态1=正常0=禁用',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='会员规则表';");

//-- -----------------------------
//-- Records of `cms_user_rule`
//-- -----------------------------
Db::execute("INSERT INTO `cms_user_rule` (`id`, `pid`, `url_name`, `name`, `ismenu`, `openType`, `icon`, `create_time`, `weigh`, `status`, `delete_time`) VALUES
(1, 0, '/user/home', '会员中心', 1, '_iframe', 'layui-icon layui-icon-user', 1700123101, 1, 1, 0),
(2, 0, '/signin/signin', '我的签到', 1, '_iframe', 'layui-icon layui-icon-username', 1700123166, 2, 1, 0),
(3, 0, '/user/profile', '个人资料', 1, '_iframe', 'layui-icon layui-icon-file-b', 1700123222, 3, 1, 0),
(4, 0, '/index/chat', '留言专区', 1, '_iframe', 'layui-icon layui-icon-reply-fill', 1700124240, 4, 1, 0),
(5, 0, '/article/add', '投稿专区', 1, '_iframe', 'layui-icon layui-icon-templeate-1', 1700124397, 5, 1, 0),
(6, 0, '/user/change', '修改密码', 1, '_iframe', 'layui-icon layui-icon-password', 1700124458, 6, 1, 0),
(7, 8, '/user/logout', '注销登录', 1, '_iframe', 'layui-icon layui-icon-logout', 1700124523, 7, 1, 0),
(8, 0, '#', '其它设置', 1, '_iframe', 'layui-icon layui-icon-set-fill', 1700140174, 8, 1, 0),
(9, 0, '/notice/detail', '最新消息', 1, '_iframe', 'layui-icon layui-icon-dialogue', 1700190495, 3, 1, 0),
(10, 8, '/game/lottery', '抽奖转盘', 1, '_iframe', 'layui-icon layui-icon-gift  ', 1700663322, 0, 1, 0),
(11, 8, '/game/heart', '红心闪烁', 1, '_iframe', 'layui-icon layui-icon-heart-fill', 1702867205, 0, 1, 0),
(12, 8, '/game/clock', '时钟页面', 1, '_iframe', 'layui-icon layui-icon-time', 1702975360, 0, 1, 0);");

//-- -----------------------------
//-- Table structure for `cms_user_log`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user_log`;
Db::execute("CREATE TABLE `cms_user_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `param_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作ID',
  `username` varchar(30) NOT NULL DEFAULT '' COMMENT '管理员名字',
  `url` varchar(1500) NOT NULL DEFAULT '' COMMENT '操作页面',
  `param` text NOT NULL COMMENT '参数json格式	',
  `type` varchar(100) NOT NULL DEFAULT '' COMMENT '日志标题',
  `action` varchar(55) NOT NULL DEFAULT '',
  `subject` varchar(80) NOT NULL,
  `content` text NOT NULL COMMENT '内容',
  `ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'IP',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作时间',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '0删除 1正常	',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `name` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='管理员日志表';");


//-- -----------------------------
//-- Table structure for `cms_user_group`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user_group`;
Db::execute("CREATE TABLE `cms_user_group` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(50) DEFAULT '' COMMENT '组名',
  `description` varchar(255) NOT NULL DEFAULT '0' COMMENT '描述',
  `rules` text COMMENT '权限节点',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '添加时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `status` tinyint(1) DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='会员组表';");

//-- -----------------------------
//-- Records of `cms_user_group`
//-- -----------------------------
Db::execute("INSERT INTO `cms_user_group` VALUES 
  ('1', 'VIP会员', 'VIP会员', '1,2,9,3,4,5,6,8,12,11,10,7', '1701400684', '1702975586', '1', '0'),
  ('2', '普通会员', '普通会员', '1,3,5,6,8,7', '1701403773', '1701404304', '1', '0');");

//-- -----------------------------
//-- Table structure for `cms_user`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_user`;
Db::execute("CREATE TABLE `cms_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `group_id` int(10) unsigned NOT NULL DEFAULT '2' COMMENT '组别ID',
  `username` varchar(32) NOT NULL DEFAULT '' COMMENT '用户名',
  `qq` bigint(20) unsigned NOT NULL DEFAULT '1' COMMENT 'qq',
  `password` varchar(32) NOT NULL DEFAULT '' COMMENT '密码',
  `salt` varchar(30) NOT NULL DEFAULT '' COMMENT '密码盐',
  `openid` varchar(32) DEFAULT '' COMMENT 'QQ绑定',
  `email` varchar(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
  `mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '手机号',
  `level` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '等级',
  `bio` varchar(100) NOT NULL DEFAULT '' COMMENT '格言',
  `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '余额',
  `score` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '积分',
  `successions` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '连续登录天数',
  `maxsuccessions` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '最大连续登录天数',
  `prev_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上次登录时间',
  `login_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录时间',
  `loginip` varchar(50) NOT NULL DEFAULT '' COMMENT '登录IP',
  `loginfailure` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '失败次数',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `token` varchar(50) NOT NULL DEFAULT '' COMMENT 'Token',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `exp_time` int(10) unsigned NOT NULL DEFAULT '0',
  `sex` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '1=男，2=女',
  `login_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录次数',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `username` (`username`) USING BTREE,
  KEY `email` (`email`) USING BTREE,
  KEY `mobile` (`mobile`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='会员表';");


//-- -----------------------------
//-- Table structure for `cms_system`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_system`;
Db::execute("CREATE TABLE `cms_system` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `key` varchar(100) DEFAULT NULL COMMENT '配置字段',
  `name` varchar(100) DEFAULT NULL COMMENT '配置名称',
  `jdata` text COMMENT '配置参数',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='系统配置表';");

//-- -----------------------------
//-- Records of `cms_system`
//-- -----------------------------
Db::execute("INSERT INTO `cms_system` VALUES 
  ('1', 'config_sina_mail', '新浪邮箱', '{\"model\":\"config_sina_mail\",\"sina\":\"on\",\"status\":\"1\",\"host\":\"smtp.sina.com\",\"email\":\"ztucke@sina.com\",\"password\":\"6a5f3a80bb5f80cf\",\"port\":\"465\"}'),
  ('2', 'config_qq_mail', 'qq邮箱', '{\"model\":\"config_qq_mail\",\"status\":\"0\",\"host\":\"smtp.qq.com\",\"email\":\"211460977@qq.com\",\"password\":\"bfurqesplgfobged\",\"port\":\"465\"}'),
  ('3', 'config_enterprise_email', '腾讯企业邮箱', '{\"model\":\"config_enterprise_email\",\"status\":\"1\",\"enterprise\":\"on\",\"host\":\"smtp.exmail.qq.com\",\"email\":\"ztucke@ztuc.cn\",\"password\":\"sql563201A\",\"port\":\"465\"}'),
  ('4', 'config_sms', '手机短信', '{\"model\":\"config_sms\",\"status\":\"1\",\"sms\":\"on\",\"url\":\"http:\\/\\/api.smsbao.com\\/\",\"name\":\"ztucke\",\"password\":\"563201\",\"key\":\"d605c3f63b184a20b7f31e28458b406d\",\"moban\":\"\\u3010\\u7ecf\\u5178\\u7f8e\\u6587\\u7f51\\u3011\\u60a8\\u7684\\u9a8c\\u8bc1\\u7801\\u662f{code}\\u3002\\u5982\\u975e\\u672c\\u4eba\\u64cd\\u4f5c\\uff0c\\u8bf7\\u5ffd\\u7565\\u672c\\u77ed\\u4fe1\"}'),
  ('5', 'config_system_settings', '系统设置', '{\"model\":\"config_system_settings\",\"filesize\":\"14833\",\"mine\":\"image\\/png\",\"image\":\"\\/uploads\\/logo\\/2024\\/06\\/27\\/55388f1f0c.png\",\"title\":\"\\u7ecf\\u5178\\u7f8e\\u6587\\u7f51\",\"mobile\":\"1\",\"email\":\"1\",\"useryzm\":\"1\",\"adminyzm\":\"0\",\"keywords\":\"\\u804a\\u5929\\u7f51, \\u7f51\\u7ad9\\u7279\\u6548, css3, html5\\u7279\\u6548, \\u7f51\\u9875\\u7279\\u6548, php\\u90ae\\u7bb1\\u627e\\u56de\\u5bc6\\u7801, PHP\\u77ed\\u4fe1\\u9a8c\\u8bc1\\u7801, canvas\\u52a8\\u753b, \\u624b\\u673a\\u5fae\\u4fe1\\u7f51\\u7ad9\\u7279\\u6548, css3\\u52a8\\u753b, html5\\u7279\\u6548, \\u7f51\\u9875\\u7279\\u6548,php\",\"description\":\"\\u7f51\\u9875\\u7279\\u6548\\u5e93-\\u4e13\\u6ce8\\u4e8eHTML5\\u3001CSS3\\u3001js\\u3001jQuery\\u3001\\u624b\\u673a\\u79fb\\u52a8\\u7aef\\u7b49\\u7f51\\u9875\\u7279\\u6548\\u7684\\u624b\\u673a\\u4e0e\\u5206\\u4eab\\u3002\\u7279\\u6548\\u5e93\\u59cb\\u7ec8\\u575a\\u6301\\uff1a\\u65e0\\u4f1a\\u5458\\u3001\\u65e0\\u79ef\\u5206\\u3001\\u65e0\\u9650\\u5236\\u7684\\u201c\\u4e09\\u65e0\\u539f\\u5219\\u201d\\uff0c\\u6240\\u6709\\u7684\\u8d44\\u6e90\\u90fd\\u514d\\u8d39\\u63d0\\u4f9b\\u5e7f\\u5927\\u7ae5\\u978b\\u4e0b\\u8f7d\\u5b66\\u4e60\\u548c\\u4f7f\\u7528\",\"copyright\":\"copmyright \\u00a9 2016-2024 all rights reserved.\",\"iphone\":\"19812919996\",\"beian\":\"\\u8700ICP\\u590718033389\\u53f7-2\"}');");

//-- -----------------------------
//-- Table structure for `cms_sms`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_sms`;
Db::execute("CREATE TABLE `cms_sms` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `event` varchar(30) NOT NULL DEFAULT '' COMMENT '事件',
  `mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
  `code` varchar(10) NOT NULL DEFAULT '' COMMENT '验证码',
  `times` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '验证次数',
  `ip` varchar(30) NOT NULL DEFAULT '' COMMENT 'IP',
  `exptime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `status` tinyint(3) unsigned DEFAULT '1' COMMENT '状态：1=正常，0=禁用	',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='短信验证码表';");


//-- -----------------------------
//-- Table structure for `cms_signin`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_signin`;
Db::execute("CREATE TABLE `cms_signin` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `user_id` int(10) unsigned NOT NULL COMMENT '用户id',
  `ip` varchar(15) NOT NULL COMMENT 'IP',
  `successions` int(11) DEFAULT NULL COMMENT '连续签到天数',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `types` enum('normal','fillup') NOT NULL DEFAULT 'normal' COMMENT '签到类型:normal签到，fillup补签',
  `status` int(11) NOT NULL DEFAULT '1' COMMENT '状态-1正常，状态-0禁用',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='签到表';");


//-- -----------------------------
//-- Table structure for `cms_online_users`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_online_users`;
Db::execute("CREATE TABLE `cms_online_users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `user_name` varchar(10) DEFAULT '' COMMENT '游客用户名',
  `session_id` varchar(50) NOT NULL DEFAULT '0' COMMENT 'sessionId',
  `last_active_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='短信验证码表';");


//-- -----------------------------
//-- Table structure for `cms_notice`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_notice`;
Db::execute("CREATE TABLE `cms_notice` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `article_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '文章id',
  `user_id` int(10) unsigned NOT NULL COMMENT '用户id',
  `uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '回复ID',
  `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'fuID',
  `pid_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'lt聊天id',
  `ip` varchar(15) DEFAULT '0' COMMENT 'ip地址',
  `content` varchar(700) NOT NULL DEFAULT '' COMMENT '评论内容',
  `reply` varchar(300) NOT NULL COMMENT '回复TA',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `datetime` varchar(10) NOT NULL DEFAULT '0' COMMENT '日期',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0',
  `status` tinyint(4) DEFAULT '1' COMMENT '状态 1待办 0已办',
  `delete_time` int(10) NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='评论表';");


//-- -----------------------------
//-- Table structure for `cms_navbar`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_navbar`;
Db::execute("CREATE TABLE `cms_navbar` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
  `type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '栏目类型1=首页2=热门3=推荐',
  `cat_name` varchar(30) NOT NULL DEFAULT '' COMMENT '名称',
  `column` tinyint(1) DEFAULT '1' COMMENT '模板1=瀑布，2=宫格',
  `description` varchar(255) NOT NULL DEFAULT '' COMMENT '描述',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `weigh` int(11) NOT NULL DEFAULT '0' COMMENT '权重',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `pid` (`pid`) USING BTREE,
  KEY `status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=27 DEFAULT CHARSET=utf8 COMMENT='分类表';");

//-- -----------------------------
//-- Records of `cms_navbar`
//-- -----------------------------
Db::execute("INSERT INTO `cms_navbar` (`id`, `pid`, `type`, `cat_name`, `column`, `description`, `create_time`, `update_time`, `weigh`, `status`, `delete_time`) VALUES
(1, 21, 1, '笑话故事', 1, '', 1584533069, 1700895414, 0, 1, 0),
(2, 21, 1, '人生折理', 1, '', 1584533069, 1700895442, 0, 1, 0),
(3, 21, 1, '励志文章', 1, '', 1584533111, 1700895452, 0, 1, 0),
(4, 22, 1, '经典语句', 1, '', 1584533120, 1700895169, 2, 1, 0),
(5, 20, 1, '心情随笔', 1, '', 1584533130, 1700841639, 0, 1, 0),
(6, 21, 1, '散文精选', 1, '', 1584882480, 1700895589, 0, 1, 0),
(7, 22, 1, '杂文小记', 1, '', 1584882622, 1700895202, 0, 1, 0),
(8, 0, 1, '代码板块', 1, '', 1584883618, 1700966455, 1, 1, 0),
(9, 0, 1, '爱情文章', 1, '', 1628069123, 1700973943, 3, 1, 0),
(10, 20, 1, '亲情文章', 1, '', 1628069180, 1700841651, 0, 1, 0),
(11, 22, 1, '校园文章', 1, '', 1628069203, 1700895216, 0, 1, 0),
(12, 20, 1, '搞笑趣事', 1, '', 1628069223, 1701526319, 0, 1, 0),
(13, 22, 1, '新闻资讯', 1, '', 1628069278, 1701564844, 0, 1, 0),
(14, 22, 1, '经典文章', 1, '', 1628069396, 1700895572, 0, 1, 0),
(15, 25, 1, '两性情爱', 1, '', 1646615644, 1700895316, 0, 1, 0),
(16, 25, 1, '两性技巧', 1, '', 1647273131, 1700895332, 0, 1, 0),
(17, 25, 1, '两性知识', 1, '', 1647273225, 1700895469, 0, 1, 0),
(18, 25, 1, '两性幽默', 1, '', 1647273283, 1700895349, 0, 1, 0),
(19, 25, 1, '两性文化', 1, '', 1682215736, 1700895536, 0, 1, 0),
(20, 0, 1, '情感文学', 1, '', 1700461330, 1700840644, 4, 1, 0),
(21, 0, 1, '散文阅读', 1, '', 1700894979, 1700894979, 0, 1, 0),
(22, 0, 1, '励志经典', 1, '', 1700895004, 1700895004, 0, 1, 0),
(23, 0, 1, '综合版块', 2, '', 1700895046, 1700973337, 0, 1, 0),
(24, 20, 1, '图片栏目', 3, '', 1700895114, 1700973322, 0, 1, 0),
(25, 0, 1, '两性健康', 1, '', 1700895281, 1701168216, 0, 1, 0),
(26, 21, 1, '下载模板', 4, '', 1700985340, 1700988079, 0, 1, 0);");

//-- -----------------------------
//-- Table structure for `cms_lottery_prize`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_lottery_prize`;
Db::execute("CREATE TABLE `cms_lottery_prize` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `uid` int(10) unsigned NOT NULL COMMENT 'uid',
  `content` varchar(500) NOT NULL DEFAULT '' COMMENT '升级内容',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8 COMMENT='版本表';");

//-- -----------------------------
//-- Records of `cms_lottery_prize`
//-- -----------------------------
Db::execute("INSERT INTO `cms_lottery_prize` (`id`, `uid`, `content`, `create_time`, `update_time`, `status`, `delete_time`) VALUES
(1, 16, '恭喜你抽中了1个月绿钻', 1700646684, 1700646684, 1, 0),
(2, 47, '恭喜你抽中了2个月绿钻', 1700646703, 1700646703, 1, 0),
(3, 76, '恭喜你抽中了3个月绿钻', 1700646713, 1700646713, 1, 0),
(4, 106, '恭喜你抽中了4个月绿钻', 1700646725, 1700646725, 1, 0),
(5, 135, '恭喜你抽中了5个月绿钻', 1700646736, 1700646736, 1, 0),
(6, 164, '恭喜你抽中了6个月绿钻', 1700646746, 1700646746, 1, 0),
(7, 193, '恭喜你抽中了7个月绿钻', 1700646756, 1713932330, 1, 1713932330),
(8, 223, '恭喜你抽中了8个月绿钻', 1700646765, 1700646765, 1, 0),
(9, 252, '恭喜你抽中了9个月绿钻', 1700646777, 1700646777, 1, 0),
(10, 284, '恭喜你抽中了10个月绿钻', 1700646788, 1700646788, 1, 0),
(11, 314, '恭喜你抽中了11个月绿钻', 1700646797, 1700646797, 1, 0),
(12, 345, '恭喜你抽中了12个月绿钻', 1700649675, 1700649675, 1, 0);");

//-- -----------------------------
//-- Table structure for `cms_lottery`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_lottery`;
Db::execute("CREATE TABLE `cms_lottery` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '会员ID',
  `content` varchar(500) NOT NULL DEFAULT '' COMMENT '奖品内容',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='版本表';");


//-- -----------------------------
//-- Table structure for `cms_keyword`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_keyword`;
Db::execute("CREATE TABLE `cms_keyword` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `word` varchar(255) NOT NULL DEFAULT '' COMMENT '敏感词',
  `type` int(11) NOT NULL DEFAULT '0',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `status` tinyint(3) unsigned DEFAULT '1' COMMENT '状态:1=正常,0=禁用',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `word` (`word`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='敏感词表';");


//-- -----------------------------
//-- Table structure for `cms_images`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_images`;
Db::execute("CREATE TABLE `cms_images` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `table_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '表id',
  `url` varchar(200) NOT NULL DEFAULT '' COMMENT '图片路径',
  `types` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '图片类型:1=banner图片，2=admin图片，3=user图片，4=article图',
  `file_size` varchar(100) NOT NULL DEFAULT '0' COMMENT '图片大小',
  `mine` varchar(30) CHARACTER SET utf8 COLLATE utf8_danish_ci NOT NULL DEFAULT '0' COMMENT 'mine类型',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态：1=正常，0=禁用',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `images` (`table_id`,`types`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='图片表';");

//-- -----------------------------
//-- Records of `cms_images`
//-- -----------------------------
Db::execute("INSERT INTO `cms_images` VALUES 
('1', '5', '/uploads/logo/2024/06/27/55388f1f0c.png', '5', '14833', 'image/png', '1', '1719470203', '0'),
('2', '1', '/uploads/lnadmin/2024/06/27/0944989c31.jpg', '2', '0', '0', '1', '1719470257', '0'),
('3', '1', '/uploads/banner/2024/06/27/55bf1e01e8.png', '1', '356719', 'image/png', '1', '1719470422', '0'),
('4', '2', '/uploads/banner/2024/06/27/47ba4f38a7.jpg', '1', '168064', 'image/jpeg', '1', '1719470441', '0'),
('5', '3', '/uploads/banner/2024/06/27/51aa4cd2f2.jpg', '1', '150805', 'image/jpeg', '1', '1719470461', '0'),
('6', '0', '/uploads/fileupload/2024/06/27/GithubDesktopZhTool-main.zip', '6', '814967', 'GithubDesktopZhTool', '1', '1719470532', '0');");

//-- -----------------------------
//-- Table structure for `cms_ems`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_ems`;
Db::execute("CREATE TABLE `cms_ems` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `event` varchar(30) NOT NULL DEFAULT '' COMMENT '事件',
  `email` varchar(100) NOT NULL DEFAULT '' COMMENT '邮箱',
  `code` varchar(10) NOT NULL DEFAULT '' COMMENT '验证码',
  `times` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '验证次数',
  `ip` varchar(30) NOT NULL DEFAULT '' COMMENT 'IP',
  `exptime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态：1=正常，0=禁用',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='邮箱验证码表';");

//-- -----------------------------
//-- Records of `cms_ems`
//-- -----------------------------
Db::execute("INSERT INTO `cms_ems` VALUES ('1', '管理员身份验证', '8142355@qq.com', 'W5BGaa', '1', '192.168.31.207', '1719470662', '1719470065', '1');");

//-- -----------------------------
//-- Table structure for `cms_click_log`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_click_log`;
Db::execute("CREATE TABLE `cms_click_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `user_id` int(11) NOT NULL COMMENT '用户id',
  `article_id` int(11) NOT NULL COMMENT '文章id',
  `ip` varchar(15) DEFAULT '' COMMENT 'IP',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `click_force` (`article_id`,`ip`,`create_time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='点赞记录';");


//-- -----------------------------
//-- Table structure for `cms_banner`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_banner`;
Db::execute("CREATE TABLE `cms_banner` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `url` varchar(255) NOT NULL DEFAULT '#' COMMENT '跳转链接',
  `desc` varchar(255) NOT NULL COMMENT '描述',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态1=正常2=禁用',
  `weigh` int(11) DEFAULT '0' COMMENT '排序',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='轮播图';");

//-- -----------------------------
//-- Records of `cms_banner`
//-- -----------------------------
Db::execute("INSERT INTO `cms_banner` VALUES 
('1', '#', '1', '1719470422', '1', '1', '0'),
('2', '#', '2', '1719470441', '1', '2', '0'),
('3', '#', '3', '1719470461', '1', '3', '0');");

//-- -----------------------------
//-- Table structure for `cms_auth_rule`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_auth_rule`;
Db::execute("CREATE TABLE `cms_auth_rule` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父ID',
  `url` varchar(100) NOT NULL DEFAULT '' COMMENT '规则URL',
  `name` varchar(50) NOT NULL DEFAULT '' COMMENT '规则名称',
  `icon` varchar(50) NOT NULL DEFAULT '' COMMENT '图标',
  `ismenu` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '是否为菜单1=显示菜单，0=隐藏',
  `openType` enum('_iframe','_blank','_layer') DEFAULT '_iframe' COMMENT '菜单类型',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `weigh` int(11) NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `rules` (`ismenu`,`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COMMENT='节点表';");

//-- -----------------------------
//-- Records of `cms_auth_rule`
//-- -----------------------------
Db::execute("INSERT INTO `cms_auth_rule` (`id`, `pid`, `url`, `name`, `icon`, `ismenu`, `openType`, `create_time`, `update_time`, `weigh`, `status`, `delete_time`) VALUES
(1, 0, 'lnadmin', '管理设置', 'layui-icon layui-icon-home', 1, '_iframe', 1584973130, 1701188011, 1, 1, 0),
(2, 0, 'navbar', '栏目设置', 'layui-icon layui-icon-list', 1, '_iframe', 1584973548, 1699882762, 4, 1, 0),
(3, 37, '/authRule/list', '菜单权限', 'layui-icon layui-icon-form', 1, '_iframe', 1584974697, 1645983256, 0, 1, 0),
(5, 1, '/lnadmin/list', '管理员名单', 'layui-icon layui-icon-username', 1, '_iframe', 1585403411, 1705888617, 0, 1, 0),
(6, 1, '/adminLog/list', '管理员日志', 'layui-icon layui-icon-log', 1, '_iframe', 1585403488, 1699957761, 0, 1, 0),
(8, 3, '/rule/edit', '编辑数据', 'layui-icon layui-icon-edit', 1, '_iframe', 1585403664, 1700661728, 1, 1, 0),
(9, 3, '/rule/add', '新增', 'layui-icon layui-icon-circle', 0, '_iframe', 1585403684, 1614306641, -3, 1, 0),
(10, 3, '/rule/del', '删除数据', 'layui-icon layui-icon-delete', 0, '_iframe', 1585403712, 1646022565, -4, 1, 0),
(11, 2, '/navbar/list', '首页导航', 'layui-icon layui-icon-link', 1, '_iframe', 1586075655, 1682210296, 0, 1, 0),
(12, 2, '/banner/list', '轮播图片', 'layui-icon layui-icon-carousel', 1, '_iframe', 1586075692, 1699959498, 0, 1, 0),
(13, 0, 'user', '会员设置', 'layui-icon layui-icon-user', 1, '_iframe', 1586093855, 1700659365, 3, 1, 0),
(14, 0, 'base', '网站设置', 'layui-icon layui-icon-set', 1, '_iframe', 1586093884, 1690112336, 5, 1, 0),
(15, 13, '/user/list', '会员管理', 'layui-icon layui-icon-username', 1, '_iframe', 1586093922, 1700659704, 0, 1, 0),
(16, 14, '/keyword/list', '敏感词语', 'layui-icon layui-icon-template-1', 1, '_iframe', 1586093952, 1682298830, 0, 1, 0),
(17, 13, '/lotteryPrize/list', '奖品管理', 'layui-icon layui-icon-gift  ', 1, '_iframe', 1586175555, 1700659682, 0, 1, 0),
(18, 14, '/image/list', '附件管理', 'layui-icon layui-icon-picture', 1, '_iframe', 1586440601, 1645981114, 0, 1, 0),
(19, 0, 'article', '文章设置', 'layui-icon layui-icon-list', 1, '_iframe', 1586528648, 1700487262, 6, 1, 0),
(20, 19, '/article/list', '文章栏目', 'layui-icon layui-icon-fire', 1, '_iframe', 1586528675, 1682298911, 0, 1, 0),
(21, 19, '/clickLog/list', '点赞日志', 'layui-icon layui-icon-praise', 1, '_iframe', 1586741429, 1645982551, 0, 1, 0),
(22, 19, '/notice/list', '回复评论', 'layui-icon layui-icon-dialogue', 1, '_iframe', 1586750321, 1701485166, 0, 1, 0),
(23, 13, '/signin/list', '签到日志', 'layui-icon layui-icon-flag', 1, '_iframe', 1587308611, 1682210140, 0, 1, 0),
(28, 55, '/sms/list', '短信日志', 'layui-icon layui-icon-email', 1, '_iframe', 1587610122, 1700730083, 0, 1, 0),
(29, 13, '/ems/list', '邮件日志', 'layui-icon layui-icon-file', 1, '_iframe', 1587610168, 1682210113, 0, 1, 0),
(32, 55, '/userToken/list', '登录状态', 'layui-icon layui-icon-senior', 1, '_iframe', 1588158191, 1700730141, 0, 1, 0),
(33, 2, '/mongodb/list', '芒果日志', 'layui-icon layui-icon-water', 1, '_iframe', 1588681397, 1682210349, 0, 1, 0),
(35, 55, '/userScoreLog/list', '积分变更', 'layui-icon layui-icon-dollar', 1, '_iframe', 1600832869, 1700730214, 0, 1, 0),
(37, 0, 'authRule', '权限设置', 'layui-icon layui-icon-auz', 1, '_iframe', 1601379732, 1701398969, 7, 1, 0),
(38, 13, '/userLog/list', '会员日志', 'layui-icon layui-icon-username', 1, '_iframe', 1601998062, 1682581930, 0, 1, 0),
(39, 19, '/articleLog/list', '浏览日志', 'layui-icon layui-icon-slider', 1, '_iframe', 1602649965, 1682210496, 0, 1, 0),
(40, 14, '/system/list', '系统管理', 'layui-icon layui-icon-set', 1, '_iframe', 1604817035, 1645978954, 0, 1, 0),
(44, 2, '/userRule/list', '个人中心', 'layui-icon layui-icon-username', 1, '_iframe', 1613459376, 1700119220, 0, 1, 0),
(45, 53, '/database/backuplist', '数据库备份', 'layui-icon layui-icon-shrink-right', 1, '_iframe', 1614082107, 1684745058, 0, 1, 0),
(46, 53, '/database/importlist', '数据库还原', 'layui-icon layui-icon-spread-left', 1, '_iframe', 1614082189, 1684745112, 0, 1, 0),
(53, 0, 'database', '数据设置', 'layui-icon layui-icon-fire', 1, '_iframe', 1614316458, 1681440993, 2, 1, 0),
(54, 37, '/authGroup/list', '角色管理', 'layui-icon layui-icon-tree', 1, '_iframe', 1614331570, 1646019522, 0, 1, 0),
(55, 13, 'Index', '二级菜单', 'layui-icon layui-icon-home', 1, '_iframe', 1644243311, 1645972778, 0, 1, 0),
(56, 1, '/lnadmin/add', '增加管理员', 'layui-icon layui-icon-delete', 1, '_iframe', 1700014851, 1705888572, 0, 1, 0),
(57, 13, '/lottery/list', '获奖管理', 'layui-icon layui-icon-gift  ', 1, '_iframe', 1700655432, 1700661843, 0, 1, 0),
(58, 1, '/lnadmin/profile', '个人资料', 'layui-icon layui-icon-vercode', 1, '_iframe', 1701183809, 1702341139, 0, 1, 0),
(59, 13, 'usergroup/list', '会员权限', 'layui-icon layui-icon-auz', 1, '_iframe', 1701398832, 1701398899, 0, 1, 0),
(60, 56, 'http://m.ztuc.cn/', '前端首页', 'layui-icon layui-icon-home', 1, '_blank', 1705888218, 1717202127, 0, 1, 0),
(61, 14, 'fileUpload/list', '文件管理', 'layui-icon layui-icon-picture', 1, '_iframe', 1716799144, 1716799224, 0, 1, 0);");

//-- -----------------------------
//-- Table structure for `cms_auth_group_access`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_auth_group_access`;
Db::execute("CREATE TABLE `cms_auth_group_access` (
  `uid` int(10) unsigned NOT NULL,
  `group_id` int(10) unsigned NOT NULL COMMENT '级别ID'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='权限分组表';");

//-- -----------------------------
//-- Records of `cms_auth_group_access`
//-- -----------------------------
Db::execute("INSERT INTO `cms_auth_group_access` VALUES ('1', '1');");

//-- -----------------------------
//-- Table structure for `cms_auth_group`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_auth_group`;
Db::execute("CREATE TABLE `cms_auth_group` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '父组别',
  `group_name` varchar(100) NOT NULL DEFAULT '' COMMENT '组名',
  `description` varchar(255) NOT NULL DEFAULT '0' COMMENT '描述',
  `rules` text NOT NULL COMMENT '规则ID',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='分组表';");

//-- -----------------------------
//-- Records of `cms_auth_group`
//-- -----------------------------
Db::execute("INSERT INTO `cms_auth_group` VALUES 
('1', '0', '超级管理员', '超级管理员是安装系统时自动生成的第一个用户，具有最高权限，可以拥有更改系统目录的权限。', '1,5,6,56,60,58,53,45,46,13,29,57,23,55,32,35,28,38,59,15,17,2,33,44,11,12,14,61,40,16,18,19,22,39,21,20,37,3,54', '1586581531', '1716799249', '1', '0'),
('2', '0', '副超级管理', '副超级管理自动生成的第一个用户，具有最高权限，可以拥有更改系统目录的权限', '1,5,6,13,15,55,28,32,35,23,29,38,2,44,11,12,33,14,16,17,18,40,19,21,20,22,39', '1601380091', '1702610798', '1', '0'),
('3', '0', '高级管理员', '高级管理员', '13,15,28,32,35,23,29,38,2,11,12,33,14,16,17,18,19,21,20,22', '1586585710', '1683256534', '1', '0'),
('4', '0', '技术操作员', '技术操作员', '13,28,32,35,23,29,38,2,11,12,33,14,16,17,18,19,21,20,22,39', '1586585672', '1683256585', '1', '0'),
('5', '0', '未分配权限', '未分配权限', '', '1683035699', '1684896935', '1', '0'),
('6', '0', '特殊权限', '管理所有', '1,56,60,58,6,5,53,46,45,13,29,38,23,55,28,32,35,57,59,15,17,2,33,44,11,12,14,40,16,18,19,39,20,21,22,37,54,3,10,9,8', '1713961730', '1713961730', '1', '0');");

//-- -----------------------------
//-- Table structure for `cms_article_log`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_article_log`;
Db::execute("CREATE TABLE `cms_article_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `name` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
  `user_id` int(10) unsigned NOT NULL COMMENT '会员ID',
  `article_id` int(11) NOT NULL COMMENT '文章id',
  `url` varchar(1500) DEFAULT '' COMMENT 'URL',
  `view` int(11) NOT NULL DEFAULT '0' COMMENT '浏览数量',
  `agent` varchar(255) DEFAULT '' COMMENT '用户代理',
  `ip` varchar(15) DEFAULT '' COMMENT 'IP',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `click_force` (`article_id`,`ip`,`create_time`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='点赞记录';");


//-- -----------------------------
//-- Table structure for `cms_article`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_article`;
Db::execute("CREATE TABLE `cms_article` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `cat_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '栏目id',
  `title` varchar(128) NOT NULL DEFAULT '' COMMENT '标题',
  `content` longtext NOT NULL COMMENT '内容',
  `types` tinyint(1) DEFAULT '1' COMMENT '类型：1=文章',
  `flag` enum('1','2','3') NOT NULL DEFAULT '1' COMMENT '标志:1=最新，2=热门，3=推荐',
  `view` int(10) unsigned DEFAULT '0' COMMENT '浏览量',
  `click` int(10) unsigned DEFAULT '0' COMMENT '点赞数',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `weigh` int(10) unsigned DEFAULT '0' COMMENT '排序',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态：1=正常，0=禁用',
  `update_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  `book_img` varchar(100) NOT NULL DEFAULT '0' COMMENT '图标',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `status` (`status`) USING BTREE,
  KEY `delete_time` (`delete_time`) USING BTREE,
  KEY `tc` (`title`,`create_time`) USING BTREE,
  KEY `idx_status` (`status`,`cat_id`,`title`) USING BTREE,
  KEY `search` (`title`,`status`) USING BTREE,
  KEY `title` (`title`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='文章数据表';");


//-- -----------------------------
//-- Table structure for `cms_admin_log`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_admin_log`;
Db::execute("CREATE TABLE `cms_admin_log` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  `param_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '数据ID',
  `username` varchar(30) NOT NULL DEFAULT '' COMMENT '管理员名字',
  `url` varchar(1500) NOT NULL DEFAULT '' COMMENT '操作页面',
  `type` varchar(100) NOT NULL DEFAULT '' COMMENT '日志标题',
  `action` varchar(55) NOT NULL DEFAULT '',
  `subject` varchar(80) NOT NULL,
  `content` text NOT NULL COMMENT '内容',
  `ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'IP',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '操作时间',
  PRIMARY KEY (`id`) USING BTREE,
  KEY `name` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='管理员日志表';");


//-- -----------------------------
//-- Table structure for `cms_admin`
//-- -----------------------------
//DROP TABLE IF EXISTS `cms_admin`;
Db::execute("CREATE TABLE `cms_admin` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '	ID',
  `group_id` int(11) NOT NULL DEFAULT '0',
  `username` varchar(20) NOT NULL DEFAULT '' COMMENT '用户名',
  `nickname` varchar(50) NOT NULL DEFAULT '' COMMENT '昵称',
  `password` varchar(32) NOT NULL DEFAULT '' COMMENT '密码',
  `salt` varchar(30) NOT NULL DEFAULT '' COMMENT '密码盐',
  `email` varchar(100) NOT NULL DEFAULT '' COMMENT '电子邮箱',
  `iphone` varchar(11) NOT NULL DEFAULT '' COMMENT '苹果手机',
  `loginip` varchar(30) DEFAULT '' COMMENT '登录IP',
  `loginfailure` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '失败次数',
  `create_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  `login_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '登录时间',
  `prev_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '上次登录时间',
  `token` varchar(59) NOT NULL DEFAULT '' COMMENT 'Session标识',
  `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态',
  `delete_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '删除时间',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='管理员表';");

//-- -----------------------------
//-- Records of `cms_admin`
//-- -----------------------------
Db::execute("INSERT INTO `cms_admin` VALUES 
  ('1', '1', 'admin', 'admin', '058fc4167d49708d9dab79c40b0e4ae6', '6e80d989de', '8142355@qq.com', '19812919996', '192.168.31.207', '171', '1584241473', '1719470092', '1719470058', '079b40a8cf1f549bad6ba71f6aac9034602426e4', '1', '0');");
  return $this->error('安装数据库完毕',url('/'));
   }  

   // uninstall
    public function uninstall()
    { 

      //-- -----------------------------
      //-- Table structure for `cms_user_token`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user_token`;");
      //-- -----------------------------
      //-- Table structure for `cms_user_score_log`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user_score_log`;");
      //-- -----------------------------
      //-- Table structure for `cms_user_rule`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user_rule`;");
      //-- -----------------------------
      //-- Table structure for `cms_user_log`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user_log`;");
      //-- -----------------------------
      //-- Table structure for `cms_user_group`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user_group`;");
      //-- -----------------------------
      //-- Table structure for `cms_user`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_user`;");
      //-- -----------------------------
      //-- Table structure for `cms_sms`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_sms`;");
      //-- -----------------------------
      //-- Table structure for `cms_signin`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_signin`;");
      //-- -----------------------------
      //-- Table structure for `cms_online_users`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_online_users`;");
      //-- -----------------------------
      //-- Table structure for `cms_notice`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_notice`;");
      //-- -----------------------------
      //-- Table structure for `cms_navbar`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_navbar`;");
      //-- -----------------------------
      //-- Table structure for `cms_lottery_prize`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_lottery_prize`;");
      //-- -----------------------------
      //-- Table structure for `cms_lottery`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_lottery`;");
      //-- -----------------------------
      //-- Table structure for `cms_keyword`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_keyword`;");
      //-- -----------------------------
      //-- Table structure for `cms_images`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_images`;");
      //-- -----------------------------
      //-- Table structure for `cms_ems`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_ems`;");
      //-- -----------------------------
      //-- Table structure for `cms_click_log`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_click_log`;");
      //-- -----------------------------
      //-- Table structure for `cms_banner`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_banner`;");
      //-- -----------------------------
      //-- Table structure for `cms_auth_rule`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_auth_rule`;");
      //-- -----------------------------
      //-- Table structure for `cms_auth_group_access`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_auth_group_access`;");
      //-- -----------------------------
      //-- Table structure for `cms_auth_group`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_auth_group`;");
      //-- -----------------------------
      //-- Table structure for `cms_system`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_system`;");
      //-- -----------------------------
      //-- Table structure for `cms_article_log`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_article_log`;");
      //-- -----------------------------
      //-- Table structure for `cms_article`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_article`;");
      //-- -----------------------------
      //-- Table structure for `cms_admin_log`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_admin_log`;");
      //-- -----------------------------
      //-- Table structure for `cms_admin`
      //-- -----------------------------
      Db::execute("DROP TABLE IF EXISTS `cms_admin`;");

  return $this->error('卸载数据库完毕',url('/'));
  } 
    // 失败请求
    protected function error($msg = '', string $url = null, $data = '', int $wait = 3, array $header = []): Response
    {
        if (is_null($url)) {
            $url = $this->request->isAjax() ? '' : 'javascript:history.back(-1);';
        } elseif ($url) {
            $url = (strpos($url, '://') || 0 === strpos($url, '/')) ? $url : $this->app->route->buildUrl($url);
        }

        $result = [
            'code' => 1,
            'msg'  => $msg ?: '未知错误',
            'data' => $data,
            'url'  => $url,
            'wait' => $wait,
        ];

        //$type = $this->getResponseType();
        $type = (request()->isJson() || request()->isAjax()) ? 'json' : 'html';
        if ($type == 'html'){
            $response = view($this->app->config->get('app.dispatch_error_tmpl'), $result);
        } else if ($type == 'json') {
            $response = json($result);
        }
        throw new HttpResponseException($response);
    }
 

}